package com.yupi.makegroup.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.makegroup.dto.TeamQuery;
import com.yupi.makegroup.model.Team;
import com.yupi.makegroup.model.User;
import com.yupi.makegroup.model.request.TeamJoinRequest;
import com.yupi.makegroup.model.request.TeamQuitRequest;
import com.yupi.makegroup.model.request.TeamUpdateRequest;
import com.yupi.makegroup.model.vo.TeamUserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author 51230
* @description 针对表【team(队伍)】的数据库操作Service
* @createDate 2025-11-08 23:25:36
*/
public interface TeamService extends IService<Team> {

    /**
     * 添加队伍
     * @param team 队伍
     * @param loginUser 登录用户
     * @return 队伍id
     */
    long addTeam(Team team, User loginUser);

    /**
     * 获取队伍列表
     * @param teamQuery 队伍查询参数
     * @param isAdmin 是否为管理员
     * @return 队伍列表
     */
    List<TeamUserVO> listTeams(TeamQuery teamQuery, boolean isAdmin);

    /**
     * 更新队伍
     * @param team 队伍
     * @param loginUser 登录用户
     * @return 是否更新成功
     */
    boolean updateTeam(TeamUpdateRequest team, User loginUser);

    /**
     * 加入队伍
     * @param teamJoinRequest 队伍加入参数
     * @param loginUser 登录用户
     * @return 是否加入成功
     */
    boolean joinTeam(TeamJoinRequest teamJoinRequest, User loginUser);

    /**
     * 退出队伍
     * @param teamQuitRequest 队伍退出参数
     * @param loginUser 登录用户
     * @return 是否退出成功
     */
    boolean quitTeam(TeamQuitRequest teamQuitRequest, User loginUser);

    boolean deleteTeam(long id, User loginUser);
}
